home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Icon 8.1 / msm-1 / common.sit / xwindow.c < prev   
Encoding:
C/C++ Source or Header  |  1992-09-19  |  4.7 KB  |  191 lines  |  [TEXT/MPS ]

  1. /*
  2.  * xwindow.c - X Window System-specific routines
  3.  */
  4. #include "::h:define.h"
  5. #include "::h:config.h"
  6. typedef struct {
  7.   char *s;
  8.   int i;
  9. } stringint, *siptr;
  10.  
  11. #ifdef XWindows
  12.  
  13. #if !VMS
  14. #undef VMS
  15. #endif                    /* VMS */
  16.  
  17. #if VMS
  18. #undef UNIX
  19. #include <stdio.h>
  20. #ifdef XpmFormat
  21. #include "::xpm:xpm.h"
  22. #endif                    /* XpmFormat */
  23. #include "decw$include:Xlib.h"
  24. #include "decw$include:Xutil.h"
  25. #include "decw$include:Xos.h"
  26. #include "decw$include:Xatom.h"
  27. #include "decw$include:cursorfont.h"
  28. #include "decw$include:keysym.h"
  29. #define UNIX 0
  30. #else                    /* VMS */
  31. #include <stdio.h>
  32. #ifdef XpmFormat
  33. #include "::xpm:xpm.h"
  34. #else                    /* XpmFormat */
  35. #include <X11/Xlib.h>
  36. #include <X11/Xutil.h>
  37. #endif                    /* XpmFormat */
  38. #include <X11/Xos.h>
  39. #include <X11/Xatom.h>
  40. #include <X11/cursorfont.h>
  41. #include <X11/keysym.h>
  42. #endif                    /* VMS */
  43.  
  44. int XIconHome  = XK_Home;
  45. int XIconLeft  = XK_Left;
  46. int XIconUp    = XK_Up;
  47. int XIconRight = XK_Right;
  48. int XIconDown  = XK_Down;
  49. int XIconPrior = XK_Prior;
  50. int XIconNext  = XK_Next;
  51. int XIconEnd   = XK_End;
  52.  
  53. /*
  54.  * Translate a key event.  Put ascii result if any in s.
  55.  * Return number of ascii (>0) if the key was "normal" and s is filled in.
  56.  * Return 0 if the key was strange and keysym should be returned.
  57.  * Return -1 if the key was a modifier key and should be dropped.
  58.  */
  59. int translate_key_event(event, s, k)
  60. XKeyEvent *event;
  61. char *s;
  62. KeySym *k;
  63. {
  64.    int i = XLookupString(event, s, 10, k, NULL);
  65.  
  66.    if (!i) {
  67.       switch (*k) {
  68.       case XK_Shift_L:
  69.       case XK_Shift_R:
  70.       case XK_Control_L:
  71.       case XK_Control_R:
  72.       case XK_Caps_Lock:
  73.       case XK_Shift_Lock:
  74.          /* for now, drop modifier events */
  75.          return -1;
  76.       default:
  77.      return 0;
  78.          }
  79.       }
  80.    else return i;
  81. }
  82.  
  83.  
  84. stringint drawops[] = {
  85.    { 0, 16},
  86.    {"and",        GXand},
  87.    {"andInverted",    GXandInverted},
  88.    {"andReverse",    GXandReverse},
  89.    {"clear",        GXclear},
  90.    {"copy",        GXcopy},
  91.    {"copyInverted",    GXcopyInverted},
  92.    {"equiv",        GXequiv},
  93.    {"invert",        GXinvert},
  94.    {"nand",        GXnand},
  95.    {"noop",        GXnoop},
  96.    {"nor",        GXnor},
  97.    {"or",        GXor},
  98.    {"orInverted",    GXorInverted},
  99.    {"orReverse",    GXorReverse},
  100.    {"set",        GXset},
  101.    {"xor",        GXxor},
  102. };
  103.  
  104. #define NUMCURSORSYMS    78
  105.  
  106. stringint cursorsyms[] = {
  107.   { 0, NUMCURSORSYMS},
  108.   {"X cursor",        XC_X_cursor},
  109.   {"arrow",        XC_arrow},
  110.   {"based arrow down",    XC_based_arrow_down},
  111.   {"based arrow up",    XC_based_arrow_up},
  112.   {"boat",        XC_boat},
  113.   {"bogosity",        XC_bogosity},
  114.   {"bottom left corner",XC_bottom_left_corner},
  115.   {"bottom right corner",XC_bottom_right_corner},
  116.   {"bottom side",    XC_bottom_side},
  117.   {"bottom tee",    XC_bottom_tee},
  118.   {"box spiral",    XC_box_spiral},
  119.   {"center ptr",    XC_center_ptr},
  120.   {"circle",        XC_circle},
  121.   {"clock",        XC_clock},
  122.   {"coffee mug",    XC_coffee_mug},
  123.   {"cross",        XC_cross},
  124.   {"cross reverse",    XC_cross_reverse},
  125.   {"crosshair",        XC_crosshair},
  126.   {"diamond cross",    XC_diamond_cross},
  127.   {"dot",        XC_dot},
  128.   {"dotbox",        XC_dotbox},
  129.   {"double arrow",    XC_double_arrow},
  130.   {"draft large",    XC_draft_large},
  131.   {"draft small",    XC_draft_small},
  132.   {"draped box",    XC_draped_box},
  133.   {"exchange",        XC_exchange},
  134.   {"fleur",        XC_fleur},
  135.   {"gobbler",        XC_gobbler},
  136.   {"gumby",        XC_gumby},
  137.   {"hand1",        XC_hand1},
  138.   {"hand2",        XC_hand2},
  139.   {"heart",        XC_heart},
  140.   {"icon",        XC_icon},
  141.   {"iron cross",    XC_iron_cross},
  142.   {"left ptr",        XC_left_ptr},
  143.   {"left side",        XC_left_side},
  144.   {"left tee",        XC_left_tee},
  145.   {"leftbutton",    XC_leftbutton},
  146.   {"ll angle",        XC_ll_angle},
  147.   {"lr angle",        XC_lr_angle},
  148.   {"man",        XC_man},
  149.   {"middlebutton",    XC_middlebutton},
  150.   {"mouse",        XC_mouse},
  151.   {"pencil",        XC_pencil},
  152.   {"pirate",        XC_pirate},
  153.   {"plus",        XC_plus},
  154.   {"question arrow",    XC_question_arrow},
  155.   {"right ptr",        XC_right_ptr},
  156.   {"right side",    XC_right_side},
  157.   {"right tee",        XC_right_tee},
  158.   {"rightbutton",    XC_rightbutton},
  159.   {"rtl logo",        XC_rtl_logo},
  160.   {"sailboat",        XC_sailboat},
  161.   {"sb down arrow",    XC_sb_down_arrow},
  162.   {"sb h double arrow",    XC_sb_h_double_arrow},
  163.   {"sb left arrow",    XC_sb_left_arrow},
  164.   {"sb right arrow",    XC_sb_right_arrow},
  165.   {"sb up arrow",    XC_sb_up_arrow},
  166.   {"sb v double arrow",    XC_sb_v_double_arrow},
  167.   {"shuttle",        XC_shuttle},
  168.   {"sizing",        XC_sizing},
  169.   {"spider",        XC_spider},
  170.   {"spraycan",        XC_spraycan},
  171.   {"star",        XC_star},
  172.   {"target",        XC_target},
  173.   {"tcross",        XC_tcross},
  174.   {"top left arrow",    XC_top_left_arrow},
  175.   {"top left corner",    XC_top_left_corner},
  176.   {"top right corner",    XC_top_right_corner},
  177.   {"top side",        XC_top_side},
  178.   {"top tee",        XC_top_tee},
  179.   {"trek",        XC_trek},
  180.   {"ul angle",        XC_ul_angle},
  181.   {"umbrella",        XC_umbrella},
  182.   {"ur angle",        XC_ur_angle},
  183.   {"watch",        XC_watch},
  184.   {"xterm",        XC_xterm},
  185.   {"num glyphs",    XC_num_glyphs},
  186. };
  187.  
  188. #else                    /* XWindows */
  189.   static char x;
  190. #endif                    /* XWindows */
  191.